#include"conio.h"
#include"stdio.h"
#include"stdlib.h"
int UCLN(int a, int b);
int main()
{
   clrscr();
   int n,a,i,x[100];
   printf("Nhap so phan tu cua mang n=");
   scanf("%d",&n);
   printf("Nhap mang %d so nguyen duong \n",n);
   for(i=1;i<=n;i++)
   {
      printf("x[%d]=",i);
      scanf("%d",&a);
      x[i]=a;
   }
   //tim uoc chung lon nhat cua day so nguyen duong do
   int k=x[1];
   for(i=2;i<=n;i++)
      k=UCLN(k,x[i]);
   printf("Uoc chung lon nhat = %d",k);
   getch();
   return 0;
}
int UCLN(int a, int b)
{
   while(a!=b)
   {
     if(a>b) a=a-b;
     else b=b-a;
   }
   return a;
}